package com.larry.java;

/**
 * @ProjectName jvm_dc
 * @Author larry
 * @Date 10:29 2021/7/26
 * @Description TODO
 **/

class Father {
    int x = 10;
    public Father(){
        this.print();
        x = 20;
    }

    public void print(){
        System.out.println("father.x = " + x);
    }
}

class Son extends Father {
    int x = 30;

    public Son(){
        this.print();
        x = 40;
    }

    @Override
    public void print(){
        System.out.println("son.x = " + x);
    }
}

public class BytecodeInterview1 {
    public static void main(String[] args) {
        Father father = new Son();
        /**
         * son.x = 0
         * son.x = 30
         * 20
         */
        System.out.println(father.x);
    }
}
